All Questions
Tagged with combinatoricsperformance
99 questions
1vote
1answer
106views
Finding the number of distinct decompositions a number has using only repdigits
This is a problem from a previous semester that I am trying to upsolve. I am trying to solve a problem involving the total number of ways of decomposing a number using only repdigits. A repdigit is a ...
1vote
1answer
126views
Effective encoding-decoding chain determination (time optimization)
Could you please help with speeding-up this code? Input: UTF-8 text (encoded 1-3 times from known pool of encodings). Every time was encoded and decoded by random encoding from pool. Original was koi8-...
1vote
1answer
81views
Query for sequential column permutations in SQLite
For dummy's sake, let's say that I have a database with columns text, ind and sentid. You ...
1vote
1answer
130views
Subset Product Algorithm
Subset Product is an NP-complete problem and is my favorite problem. So, I've written a slightly smarter way of solving the problem. Will performance impact matter if I use multi-cpus and my GPU? Do ...
1vote
1answer
182views
Absolute Permutation | Hacker Rank: Any way to make this python code faster without changing it's whole logic?
https://www.hackerrank.com/challenges/absolute-permutation/problem I know that if you work out the math and logic first, the algorithm can be simplified greatly (shifting indices), but is that the ...
2votes
1answer
1kviews
Fast brute force numpy array combination
I want to extract the combinations of numpy arrays in this way: ...
0votes
1answer
2kviews
Generating permutations fast
I run into a performance bottleneck in a program. I have to generate all permutations for a given sequence with size up to n=11. My code: ...
6votes
1answer
601views
Combinatorics, C++ and optimization
Note: I have a working solution, my question is about optimization and other approaches. Problem Description Hello, I'm re-writing an old program I made that solves nonograms. As part of solving it, I ...
5votes
1answer
331views
Permutations in C
I searched on the internet for an algorithm for permutations in C and I found the following function: ...
4votes
1answer
93views
Filter out unwanted substrings while generating all possible relevant substrings
Write a Program that determines where to add periods to a decimal string so that the resulting string is a valid IP address. There may be more than one valid IP address corresponding to a string, ...
8votes
3answers
294views
Refactor the code which performs "cross-product", "reduce", "product of list" and "sum of list"
I have come up with a sequence of steps to find the maximum product of y positive numbers which add up to x. But the program is ...
5votes
4answers
452views
Check whether a permutation with one fixed point can be rotated into one with two fixed points
A friend gave me the following riddle: Given n people with n distinct names, you place n names tags on a round table with n seats. If the n people now sit at those seats randomly such that exactly ...
3votes
3answers
136views
BFF Word Finder
Inspired by this question on Puzzling.StackExchange, I've decided to write a small python script that determines if a word is a BFF Word. Below are the parameters, solved by Puzzling user Stiv, also ...
4votes
2answers
126views
Find only one subset sum with a specified value for large sets
How can I optimize my code for a large set (10,000 elements)? ...
5votes
1answer
283views
Performance of mask (1,2,4,8,16) convertor in python
My mask translator is performing poorly in scenario where I have 30 masks and 10,000 ownerships. This is a bit field and similar to bit masks such as enum.IntFlag. ...